<?php

namespace app\adminapi\logic\organize;

use adminmatrix\admin\logic\BaseLogic;
use adminmatrix\admin\annotation\Inject;
use app\adminapi\model\organize\AdminOrganization;
use app\Request;
use think\exception\HttpException;
use app\adminapi\validate\organize\AdminOrganizationValidate;
class AdminOrganizationLogic extends BaseLogic
{
    #[Inject]
    protected AdminOrganization $model;


    public function save(Request $request) : bool
    {
        try {
            $params = (new AdminOrganizationValidate) -> post()->goCheck();
            $params['creator_id'] = $request->admin_id;
            return $this->model->save($params);
        } catch (HttpException $e)
        {
            throw new HttpException(200 , $e->getMessage());
        }
    }
}